// 下载第三方模块 npm i mongoose 并导入
const mongoose = require('mongoose');
mongoose.connect('mongodb://root:root@localhost', { useNewUrlParser: true, useUnifiedTopology: true })
    .then(() => console.log('数据库连接成功'))
    .catch(() => console.log('数据库连接失败'))

// async function fn() {
//     let result = await commentData.create({
//         username: '匿名用户',
//         add_time: new Date(),
//         content: 'Node.js从入门到精通'
//     });
//     console.log(result);
// };
// fn()